using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;


namespace xna_game_engine.source
{
    /// <summary>
    /// This is a game component that implements IUpdateable.
    /// </summary>
    public class BaseItem
    {
        public enum ItemTypes { ARMOR, SHIELD, WEAPON, POTION };

        private const int MAX_NAME_LENGTH = 24;

        // Members
        protected ItemTypes mType;
        protected string mName;
        protected int mValue;
        /// <summary>
        /// Mods to base stats such as stamina, strength, etc...
        /// </summary>
        protected Dictionary<string, int> mStatMods;

        /// <summary>
        /// Other mods such as defense, health, etc..
        /// </summary>
        protected Dictionary<string, int> mMods;

        /// <summary>
        /// Valid equipment slots for this item
        /// </summary>
        //protected List<EQUIPMENT_SLOTS> mValidEquipSlots;

        // Functions
        #region Functions
        public BaseItem(string name)
        {
            // TODO: Construct any child components here
            FormatName(name);
            mStatMods = new Dictionary<string, int>();
            mMods = new Dictionary<string, int>();
            //mValidEquipSlots = new List<EQUIPMENT_SLOTS>();
            mStatMods.Add("Strength", 0);
            mStatMods.Add("Agility", 0);
            mStatMods.Add("Focus", 0);
            mStatMods.Add("Speed", 0);

            mMods.Add("Health", 0);
            mMods.Add("Power", 0);
            //mMods.Add("Attack", 0);
            //mMods.Add("Defense", 0);
            //mMods.Add("HealthRegen", 0);
            //mMods.Add("ManaRegen", 0);
        }

        public BaseItem Clone()
        {
            return (BaseItem)this.MemberwiseClone();
        }

        private void FormatName(string name)
        {
            mName = name;
            //if (name.Length < MAX_NAME_LENGTH)
            //{
            //    mName = name.PadRight(MAX_NAME_LENGTH);
            //}
            //else if (name.Length > MAX_NAME_LENGTH)
            //{
            //    mName = name.Remove(MAX_NAME_LENGTH);
            //}
        }
        #endregion

        #region Properties
        public int Speed
        {
            get { return mStatMods["Speed"]; }
            set { mStatMods["Speed"] = value; }
        }
        public int Strength
        {
            get { return mStatMods["Strength"]; }
            set { mStatMods["Strength"] = value; }
        }
        public int Focus
        {
            get { return mMods["Focus"]; }
            set { mMods["Focus"] = value; }
        }
        public int Agility
        {
            get { return mStatMods["Agility"]; }
            set { mStatMods["Agility"] = value; }
        }

        public int Health
        {
            get { return mMods["Health"]; }
            set { mStatMods["Health"] = value; }
        }
        public int Power
        {
            get { return mMods["Power"]; }
            set { mStatMods["Power"] = value; }
        }
        //public int Attack
        //{
        //    get { return mMods["Attack"]; }
        //    set { mStatMods["Attack"] = value; }
        //}
        //public int HealthRegen
        //{
        //    get { return mMods["HealthRegen"]; }
        //    set { mStatMods["HealthRegen"] = value; }
        //}

        //public int ManaRegen
        //{
        //    get { return mMods["ManaRegen"]; }
        //    set { mStatMods["ManaRegen"] = value; }
        //}

        public string Name
        {
            get { return mName; }
        }

        public ItemTypes Type
        {
            get { return mType; }
            set { mType = value; }
        }

        //public List<EQUIPMENT_SLOTS> Slots
        //{
        //    get { return mValidEquipSlots; }
        //}

        public Dictionary<string, int> Mods
        {
            get { return mMods; }
        }

        public Dictionary<string, int> StatMods
        {
            get { return mStatMods; }
        }
        #endregion
    }
}